package com.fbs.wowo.correctRight.web;


import com.fbs.wowo.base.BaseController;
import com.fbs.wowo.base.Response;
import com.fbs.wowo.correctRight.entity.CorrectRight;
import com.fbs.wowo.correctRight.service.CorrectRightService;
import com.fbs.wowo.correctRight.vo.CorrectRightQuery;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("correctRight")
public class CorrectRightController extends BaseController {

    @Resource
    private CorrectRightService correctRightService;

    /**
     * 申请版权
     * @param record
     * @return
     */
    @PostMapping("insert")
    public Response insert(CorrectRight record){
        return success(correctRightService.insertSelective(record));
    }

    /**
     * 取消审核
     */
    @PostMapping("delete")
    public Response delete(String essayId){
        return success(correctRightService.deleteByEssayId(essayId));
    }

    /**
     * 列表
     */
    @GetMapping("findCorrectRightList")
    public Response findCorrectRightList(CorrectRightQuery crq){
        return success(correctRightService.findCorrectRightList(crq));
    }

    /**
     * 确权数据详情
     */
    @GetMapping("findInfo")
    public Response findInfo(String essayId){
        return success(correctRightService.findCorrectRightInfoByEssayId(essayId));
    }


    /**
     * 审核成功
     */
    @PostMapping("success")
    public Response success(String articleId, int type){
        return success(correctRightService.reviewTheSuccess(articleId,type));
    }

    /**
     * 审核失败
     */
    @PostMapping("failure")
    public Response failure(String articleId,int type){
        return success(correctRightService.reviewTheFailure(articleId, type));
    }

}
